package com.inspur.icity.bus.api.user.service;

import com.inspur.icity.bus.api.user.model.BusSearchHistory;
import com.inspur.icity.bus.api.user.repo.BusSearchHistoryDao;
import com.inspur.icity.bus.base.core.service.CrudService;
import com.inspur.icity.bus.base.core.util.DateUtil;
import org.springframework.stereotype.Service;

/**
 * 搜索历史Service
 */
@Service
public class BusSearchHistoryService extends CrudService<BusSearchHistoryDao, BusSearchHistory, Integer> {

    /**
     * 保存用户搜索历史：线路、站点
     * @param name 线路
     * @param direction 方向
     * @param routeId 线路ID号
     * @param type 1：线路 ，2：站点
     * @param mobile 手机号
     */
    public void saveSearchHistory(String name, String direction, Integer updown,Integer routeId, int type, String mobile,String areacode) {
        BusSearchHistory userSearch = new BusSearchHistory();
        userSearch.setMobile(mobile);
        userSearch.setName(name);
        userSearch.setDirection(direction);
        userSearch.setUpdown(updown);
        userSearch.setRouteId(routeId);
        userSearch.setType(type);
        userSearch.setCreateTime(DateUtil.getSystemTime());
        userSearch.setAreacode(areacode);
        add(userSearch);
    }
}